package ucap.com.lesanapp.main;

import android.app.Application;
import android.os.Process;
import android.util.Log;

import com.umeng.analytics.MobclickAgent;

/**
 * Created by wekingwang on 16/8/8.
 */
public class MainApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        Log.i("application", "程序入口");
        Thread.setDefaultUncaughtExceptionHandler(new MyException());
    }

    /**
     * 全局异常捕获
     */
    class MyException implements Thread.UncaughtExceptionHandler {
        @Override
        public void uncaughtException(Thread thread, Throwable ex) {
            MobclickAgent.onKillProcess(getApplicationContext());//保存友盟统计结果
            Process.killProcess(Process.myPid());
            ex.printStackTrace();
        }
    }
}
